#pragma once

#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<stdbool.h>

typedef int TreeTypedate;

typedef struct Treenode
{
	TreeTypedate a;
	struct Treenode* left;
	struct Treenode* right;
}Tnode;

void PrevOrder(Tnode* root);
void InOrder(Tnode* root);
void EndOrder(Tnode* root);

int TreeSize(Tnode* root);
int LeafSsize(Tnode* root);
int LevelSize(Tnode* root, int k);

int TreeHeight(Tnode* root);
void TreeDestroy(Tnode* root);

Tnode* CreatTree(char* ch, int* pi);
Tnode* findNode(Tnode* root, TreeTypedate x);

bool isValTree(Tnode* root);
bool issameTree(Tnode* p, Tnode* q);

bool mirrorTree(Tnode* root);
bool issunTree(Tnode* root, Tnode* subroot);

void levelOrder(Tnode* root);
void levelOrdermax(Tnode* root);

bool completeTree(Tnode* root);

